<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    /* 转换为布尔值，除了:
    ''、0、undefined、null、false、NaN
    转换后为false，其余都为true
    */
    console.log(Boolean(''));
    console.log(Boolean(0));
    console.log(Boolean(undefined));
    console.log(Boolean(null));
    console.log(Boolean(false));
    console.log(Boolean(NaN));
    console.log(Boolean(1));
    console.log(Boolean('2'));
    console.log(Boolean('abc'));


  </script>
</body>

</html>